package com.own.business.system.user.controller.user;

import com.own.business.login.controller.LoginController;
import com.own.business.system.user.controller.user.entity.form.UpdatePasswordForm;
import com.own.business.system.user.controller.user.open.UserSystemUserLoginOpen;
import com.own.component.common.model.R;
import com.own.component.common.model.ResultModel;
import com.own.component.log.operation.aop.LogOperationAop;
import com.own.constant.ConstantApiPrefix;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * UserSystemUserLoginController
 *
 * @author chenxueli
 * @date 2023-08-09 16:02:39
 */
@Slf4j
@Tag(name = "系统用户登录" + ConstantBeanSuffix.USER_CLIENT + ConstantBeanSuffix.CONTROLLER)
@RestController
@RequestMapping(ConstantApiPrefix.BASE_API_V1_PREFIX + "user/system/user/login")
public class UserSystemUserLoginController extends LoginController {

    @Resource
    private UserSystemUserLoginOpen userSystemUserLoginOpen;

    @LogOperationAop
    @Operation(summary = "修改密码")
    @PostMapping("/update/password")
    public ResultModel<Boolean> updatePassword(
            @RequestBody UpdatePasswordForm form
    ) {
        var flag = userSystemUserLoginOpen.updatePassword(form);
        return R.success(flag, "修改成功");
    }

}
